package it.polimi.digitalstate.manager;

import java.util.LinkedList;

import it.polimi.digitalstate.dto.CitizenDTO;
import it.polimi.digitalstate.dto.MembershipDTO;
import it.polimi.digitalstate.dto.PartyDTO;
import it.polimi.digitalstate.persist.SuperEntityManagerException;

import javax.ejb.Local;

@Local
public interface PartyManagerLocal {
	/**
	 * Return the list of parties presented in the database [during the current election ( TODO ) ]
	 *
	 * @return      The likedlist of the parties in [alphabetical order ( TODO )]
	 * @see         PartyDTO 
	 * @see  		ElectionDTO ( TODO )
	 * @see 		IDataTransferObject
	 */
	public LinkedList<PartyDTO> getListOfParty();
	/**
	 * Given a Party Data Transfer Object, it will create a New Party in the database
	 * ( TODO ) will be a parameter to see also who is the creator in such the way  that the system will:
	 * 1) check if the creator is not already member of another party
	 * 2) then the creator will be automatically a member of the new party
	 * 
	 * @param 		party_dto	The Data Transfer Object that specify the new party
	 * @param pdfname 
	 * @throws SuperEntityManagerException 
	 * @exception	name_already_used	( TODO )
	 * @exception	citizen_already_member   ( TODO )
	 * @see         PartyDTO 
	 * @see  		CitizenDTO
	 * @see			Membership
	 * @see 		IDataTransferObject
	 */
	public void createNewParty(PartyDTO party_dto,CitizenDTO citizen, String pdfname) throws SuperEntityManagerException ;
	/**
	 * Given a Party Data Transfer Object, it will retrieve the member list of that party
	 * 
	 * @param 		party	The data transfer object that specify the new party
	 * @see         PartyDTO 
	 * @see  		CitizenDTO
	 * @see			Membership
	 * @see 		IDataTransferObject
	 */
	public MembershipDTO[] getListOfMember(PartyDTO party);
	/**
	 * Given a Citizen Data Transfer Object, it will retrieve the party that the citizen is member of.
	 * 
	 * @param 		citizen	The data transfer object that specify the citizen
	 * @see         PartyDTO 
	 * @see  		CitizenDTO
	 * @see			Membership
	 * @see 		IDataTransferObject
	 */
	public PartyDTO getPartyByCitizen(CitizenDTO citizen);
	/**
	 * Given a Citizen Data Transfer Object, it will say if the citizen has a party or not.
	 * 
	 * @param 		citizen	The data transfer object that specify the citizen
	 * @return 		true if the citizen is member of a party, false otherwise
	 * @see         PartyDTO 
	 * @see  		CitizenDTO
	 * @see			Membership
	 * @see 		IDataTransferObject
	 */
	public boolean hasParty(CitizenDTO citizen);
	/**
	 * Retrieve the PartyDTO given the name
	 * 
	 * @param 		name This represents the name of the Party
	 * @return 		return the party by the name
	 * @see         PartyDTO 
	 * @see  		CitizenDTO
	 * @see			Membership
	 * @see 		IDataTransferObject
	 */
	public PartyDTO getPartyByName(String name);
	/**
	 * Retrieve the Membership by the id
	 * 
	 * @param 		id represent the id of the membership
	 * @return 		return MembershipDTO
	 * @see  		CitizenDTO
	 * @see			Membership
	 * @see 		IDataTransferObject
	 */
	public MembershipDTO getMembershipByID(int id);
	
	public boolean canCreateParty(CitizenDTO citizen);
}
